package com.nervenets.web.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Menu implements Serializable {
    private String name;
    private String code;
    private boolean must = false;
    private boolean enable = true;
    private List<Menu> actions = new ArrayList<>();

    public Menu(String name, String code, boolean must) {
        this.name = name;
        this.code = code;
        this.must = must;
    }

    public Menu(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public Menu add(Menu menu) {
        this.actions.add(menu);
        return this;
    }
}
